import axios from '@/libs/api.request'
import config from '@/config'

export const getBusinessTable = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'AdminService.viewAccount',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const editBusinessRecord = async (playload) => {
  let module_name = 'AdminService.createAccount'
  if (playload.tid && playload.tid !== '') {
    module_name = 'AdminService.infoUpdate'
  }
  const data = {
    module: module_name,
    ...playload
  }
  const resp = await axios.request({
    url: config.postUrl,
    data,
    method: 'post'
  })
  return resp
}

export const getAgentTable = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'AdminService.agentList',
      ...playload
    },
    method: 'get'
  })
  return resp
}
